package ru.klavogonki.kgparser.servlet.entity;

import ru.klavogonki.kgparser.entity.CompetitionEntity;
import ru.klavogonki.kgparser.entity.CompetitionEntityService;
import su.opencode.kefir.web.Action;
import su.opencode.kefir.web.InitiableAction;
import su.opencode.kefir.web.JsonServlet;

import java.util.List;

/**
 * Copyright 2014 <a href="mailto:dmitry.weirdo@gmail.com">Dmitriy Popov</a>.
 * $HeadURL: http://kgparser.googlecode.com/svn/trunk/kgparserWeb/src/main/java/ru/klavogonki/kgparser/servlet/entity/CompetitionsListServlet.java $
 * $Author: dmitry.weirdo@gmail.com $
 * $Revision: 64 $
 * $Date:: 2014-02-15 17:40:39 #$
 */
public class CompetitionsListServlet extends JsonServlet
{
	@Override
	protected Action getAction() {
		return new InitiableAction()
		{
			@Override
			public void doAction() throws Exception {
				CompetitionEntityService service = getService(CompetitionEntityService.class);
				List<CompetitionEntity> competitionEntities = service.getCompetitionEntities();

				writeSuccess(competitionEntities);
			}
		};
	}
}